<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<div class="setp_top">
	<div class="setp_top_btn">
		<input type="button" class="btn_ok" onclick="validateForm()" />
		<input type="button" class="btn_cancel" onclick="prevStep()" />
	</div>
	<s:property value="#typeTxt"/>&nbsp;<s:property value="#workStatusTxt"/>
</div>
<s:if test="work.item.type == 4">
	<jsp:include page="workstep3_express.jsp"></jsp:include>
</s:if>
<s:elseif test="work.item.type == 5">
	<jsp:include page="workstep3_trucking.jsp"></jsp:include>
</s:elseif>
<s:elseif test="work.item.type > 5">
<div class="setp_main">
	<table class="table" cellpadding="0" cellspacing="0" style="width:100%;table-layout: fixed;">
		<tr class="title">
			<td><span class="stress">*</span>&nbsp;<s:property value="#orgTxt"/>ORG：</td>
		</tr>
		<tr>
			<td>
				<input type="text" style="display: none;" />
            	<input type="text" id="pointORG" name="pointORG" value="<s:property value="work.pointORG.fullname" />" autocomplete="off" tabindex="1"
            		onkeyup="seachDataByKeyword('searchPointBykeyword?portType=0',this.value,'pointORG','pointORGId',0,235);" onblur="inputPoint()" />
           		<input type="hidden" id="pointORGId" name="work.pointORG.id" value="<s:property value="work.pointORG.id" />"/>
			</td>
		</tr>
	</table>
</div>
<script>
var preErrorId = [];
function validateForm(){
	var errorId = [];
	var errorMsg = '';
	var orgId = $('#pointORGId').val();
	if(orgId == ''){
		errorId[errorId.length] = 'pointORG';
		errorMsg += '<s:property value="#orgTxt" escape="false"/>不能为空\r\n';
	}
	if(typeof saveAllWorkItem == 'function'){
		errorMsg += saveAllWorkItem();
	}
	for(i=0; i<preErrorId.length; i++){
		normalCssJNice(preErrorId[i]);
	}
	if(errorMsg != ''){
		preErrorId = errorId;
		for(i=0; i< errorId.length; i++){
			errorCssJNice(errorId[i]);
		}
		alert(errorMsg);
		return;
	}
	var params = $("#workForm").serialize();
	$.post('cts/workStep3?save=true',params,function(result){
		if(result.trim() == 'null'){
			alert('订单不存在或已经被删除');
		}else if(result.trim() == 'status5'){
			alert('该订单已归档');
		}else if(result.trim() == 'ok'){
			nextStep();
		}else{
			alert('保存失败');
		}
	})
}
function inputPoint(){
	if(typeof changeTypeDetail == 'function') changeTypeDetail();
}
</script>

</s:elseif>
<s:else>
<div class="setp_main">
	<table class="table" cellpadding="0" cellspacing="0" style="width:100%;table-layout: fixed;">
		<tr class="title">
			<td width="285px"><span class="stress">*</span>&nbsp;<s:property value="#orgTxt"/>ORG：</td>
			<td width="190px"><div id="transhipType1Title"><span class="stress" style="margin-left: 25px;">*</span>&nbsp;接驳工具：</div></td>
			<td><span class="stress">*</span>&nbsp;<s:property value="#polTxt"/>POL：</td>
		</tr>
		<tr>
			<td>
            	<input type="text" id="pointORG" name="pointORG" value="<s:property value="work.pointORG.fullname" />" autocomplete="off" tabindex="1"
            		onkeyup="seachDataByKeyword('searchPointBykeyword?portType='+pointType,this.value,'pointORG','pointORGId',0,235);" onblur="inputPoint('ORG')" />
           		<input type="hidden" id="pointORGId" name="work.pointORG.id" value="<s:property value="work.pointORG.id" />"/>
				<a id="orgInfoBtn" href="javascript:openPopDiv('orgInfo')" class="btn_info">&nbsp;</a>
			</td>
			<td align="center" id="transhipType1Td">
				<img src="${pageContext.request.contextPath}/cts/images/arrow_r.png" style="margin-right: 32px;"/>
				<div style="text-align: left; display:none">
					<img src="${pageContext.request.contextPath}/cts/images/arrow_r.png" style="float: left; margin-top: 14px; margin-right: 5px;" />
					<s:select id="transhipType1" name="work.transhipType1.id" cssStyle="width: 130px;" headerKey="0" headerValue="请选择" list="#request.allTranshipType" listKey="id" listValue="name" value="work.transhipType1.id"></s:select>
					<img src="${pageContext.request.contextPath}/cts/images/arrow_r.png" style="float: right; margin-top: 14px;" />
					<font style="line-height: 44px;">&nbsp;</font>
				</div>
			</td>
			<td>
            	<input type="text" id="pointPOL" name="pointPOL" value="<s:property value="work.pointPOL.fullname" />" autocomplete="off" tabindex="2"
            		onkeyup="seachDataByKeyword('searchPointBykeyword?portType='+(pointType+1),this.value,'pointPOL','pointPOLId',0,235);" onblur="inputPoint('ORG')" />
           		<input type="hidden" id="pointPOLId" name="work.pointPOL.id" value="<s:property value="work.pointPOL.id" />"/>
				<a id="polInfoBtn" href="javascript:openPopDiv('polInfo')" class="btn_info">&nbsp;</a>
			</td>
		</tr>
		<tr class="title">
			<td colspan="2" rowspan="2">
				<div style="width: 90%; height:110px; margin-left:8px; border:1px dashed #676767; text-align: center;word-wrap: break-word; ">
					<s:if test="work.item.type != 3">
						<br style="line-height: 25px;" />
						<span class="stress">*</span>&nbsp;
							<s:if test="work.item.type==1">箱量/柜号：&nbsp;&nbsp;&nbsp;&nbsp;</s:if>
							<s:elseif test="work.item.type==2">柜号：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</s:elseif>
						<br />
						<br id="boxTitle" style="line-height: 10px;" />
						<s:if test="work.boxAmount != null && work.boxAmount != ''">
							<span id="boxSpan"><s:property value="work.boxAmount"/></span><br />
							<br style="line-height: 10px;" />
						</s:if>
						<a href="javascript:openPopDiv('boxAmountDiv','showBoxAmount?workId=<s:property value="work.id" />')" style="color: blue">点击此处添加</a>
					</s:if>
				</div>
			</td>
			<td>
				<div style="width: 230px; text-align: center; margin-bottom:8px; margin-left: 8px;">
					<img src="${pageContext.request.contextPath}/cts/images/arrow_d.png" />
				</div>
				&nbsp;&nbsp;<s:property value="#tpTxt"/>T/P：
			</td>
		</tr>
		<tr>
			<td>
            	<input type="text" id="pointTP" name="pointTP" value="<s:property value="work.pointTP.fullname" />" autocomplete="off" tabindex="3"
            		onkeyup="seachDataByKeyword('searchPointBykeyword?portType='+(pointType+1),this.value,'pointTP','pointTPId',0,235);" />
           		<input type="hidden" id="pointTPId" name="work.pointTP.id" value="<s:property value="work.pointTP.id" />"/>
				<div style="width: 230px; text-align: center; margin-top:10px;">
					<img src="${pageContext.request.contextPath}/cts/images/arrow_d.png" />
				</div>
			</td>
		</tr>
		<tr class="title">
			<td><span class="stress">*</span>&nbsp;<s:property value="#desTxt"/>DES：</td>
			<td><div id="transhipType2Title"><span class="stress" style="margin-left: 25px;">*</span>&nbsp;接驳工具：</div></td>
			<td><span class="stress">*</span>&nbsp;<s:property value="#podTxt"/>POD：</td>
		</tr>
		<tr>
			<td>
            	<input type="text" id="pointDES" name="pointDES" value="<s:property value="work.pointDES.fullname" />" autocomplete="off" tabindex="5"
            		onkeyup="seachDataByKeyword('searchPointBykeyword?portType='+pointType,this.value,'pointDES','pointDESId',0,235);" onblur="inputPoint('DES')" />
           		<input type="hidden" id="pointDESId" name="work.pointDES.id" value="<s:property value="work.pointDES.id" />"/>
				<a id="desInfoBtn"href="javascript:openPopDiv('desInfo')" class="btn_info">&nbsp;</a>
			</td>
			<td align="center" id="transhipType2Td">
				<img src="${pageContext.request.contextPath}/cts/images/arrow_l.png" style="margin-right: 32px;"/>
				<div style="text-align: left;display:none">
					<img src="${pageContext.request.contextPath}/cts/images/arrow_l.png" style="float: left; margin-top: 14px; margin-right: 5px;" />
					<s:select id="transhipType2" name="work.transhipType2.id" cssStyle="width: 130px;" headerKey="0" headerValue="请选择" list="#request.allTranshipType" listKey="id" listValue="name" value="work.transhipType2.id"></s:select>
					<img src="${pageContext.request.contextPath}/cts/images/arrow_l.png" style="float: right; margin-top: 14px;" />
					<font style="line-height: 44px;">&nbsp;</font>
				</div>
			</td>
			<td>
            	<input type="text" id="pointPOD" name="pointPOD" value="<s:property value="work.pointPOD.fullname" />" autocomplete="off" tabindex="4"
            		onkeyup="seachDataByKeyword('searchPointBykeyword?portType='+(pointType+1),this.value,'pointPOD','pointPODId',0,235);" onblur="inputPoint('DES')" />
           		<input type="hidden" id="pointPODId" name="work.pointPOD.id" value="<s:property value="work.pointPOD.id" />"/>
				<a id="podInfoBtn" href="javascript:openPopDiv('podInfo')" class="btn_info">&nbsp;</a>
			</td>
		</tr>
	</table>
	<table class="table" cellpadding="0" cellspacing="0" style="width: 100%; margin-top:50px; table-layout: fixed;">
		<tr class="title">
			<td width="230px;"><span class="stress">*</span>&nbsp;
				<s:if test="work.item.type==1">订舱代理：</s:if>
				<s:elseif test="work.item.type==2">拼箱公司：</s:elseif>
				<s:elseif test="work.item.type==3">航空代理：</s:elseif>
			</td>
			<td width="185px;"><span class="stress">*</span>&nbsp;
				<s:if test="work.item.type!=3">船东：</s:if>
				<s:elseif test="work.item.type==3">航空公司：</s:elseif>
			</td>
			<td width="150px;">&nbsp;&nbsp;<s:if test="work.item.type!=3">订舱号：</s:if><s:else>空运单号：</s:else></td>
			<td>&nbsp;&nbsp;<s:if test="work.item.type!=3">提单号：</s:if></td>
		</tr>
		<tr>
			<td>
				<input type="text" id="bookingAgent" name="bookingAgent" value="<s:property value="work.bookingAgent.nickname" />"
					onkeyup="seachDataByKeyword('searchEmployeeBykeyword.action?type=1',this.value,'bookingAgent','bookingAgentId',0,150);" style="width:150px">
				<input type="hidden" id="bookingAgentId" name="work.bookingAgent.id" value="<s:property value="work.bookingAgent.id" />">
				<a href="javascript:addEmployee('bookingAgent')" class="add_btn">&nbsp;</a>
			</td>
			<td style="white-space: nowrap">
				<s:select id="carrier" name="work.carrier.id" cssStyle="width:175px"
					list="#request.allCarrier" headerKey="0" headerValue="请选择" listKey="id" listValue="name" value="work.carrier.id"></s:select>
				<font style="line-height: 45px; margin-left: -40px;">&nbsp;</font>
			</td>
			<td><input type="text" id="bookingNumber" name="work.bookingNumber" value="<s:property value="work.bookingNumber" />" style="width:130px"/></td>
			<td>
				<s:if test="work.item.type!=3">
					<input type="text" id="blNumber" name="work.blNumber" value="<s:property value="work.blNumber" />" style="width:130px"/>
				</s:if>
				<s:else>&nbsp;</s:else>
			</td>
		</tr>
		<tr class="title">
			<td colspan="4">&nbsp;&nbsp;运输要求：</td>
		</tr>
		<tr>
			<td colspan="4">
				<textarea id="deliveryRequirements" name="work.deliveryRequirements" class="input_xl jNiceTextarea"><s:property value="work.deliveryRequirements"/></textarea>
			</td>
		</tr>
		<tr class="title">
			<td colspan="4">&nbsp;&nbsp;运输反馈：</td>
		</tr>
		<tr>
			<td colspan="4">
				<textarea id="deliveryFeedback" name="work.deliveryFeedback" class="input_xl jNiceTextarea"><s:property value="work.deliveryFeedback"/></textarea>
			</td>
		</tr>
		<tr class="title">
			<td colspan="4"><span class="stress">*</span>&nbsp;
				<s:if test="work.item.type==1">船东运输条款：</s:if>
				<s:elseif test="work.item.type==2">拼箱公司运输条款：</s:elseif>
				<s:elseif test="work.item.type==3">航空代理运输条款：</s:elseif>
			</td>
		</tr>
		<tr>
			<td colspan="4">
				<s:select id="cy2cy2" name="work.cy2cy2.id" list="#request.allCy2cy" headerKey="0" headerValue="请选择交接方式" listKey="id" listValue="name" value="work.cy2cy2.id" cssStyle="margin-right:22px; _margin-right:16px;"></s:select>
				<s:select id="payment2" name="work.payment2.id"
					list="#request.allPayment" headerKey="0" headerValue="请选择运费支付方式" listKey="id" listValue="name" value="work.payment2.id" cssStyle="margin-right:22px; _margin-right:16px;"></s:select>
				<s:if test="work.item.type != 3">
					<s:select id="releaseCargoType2" name="work.releaseCargoType2.id"
						list="#request.allReleaseCargoType" headerKey="0" headerValue="请选择放货方式" listKey="id" listValue="name" value="work.releaseCargoType2.id"></s:select>
				</s:if>
			</td>
		</tr>
	</table>
</div>
<!-- 出发地信息 -->
<div id="orgInfo" class="popdiv_inner">
	<div class="popdiv_inner_outter"></div>
	<div class="popdiv_close" onclick="cancelPointInfo('orgInfo')"></div>
	<div class="popdiv_handle" style="font-size: 12px;" title="鼠标左键按住可拖动"><s:property value="#orgTxt"/>信息</div>
	<div class="popdiv_content" style="500px">
		<table style="width: 100%; font-size: 14px; border-bottom: 1px solid #d0d0d0;">
			<s:if test="work.item.type == 1">
				<tr>
					<td align="right">船名/航次：</td>
					<td>
						<input type="text" id="oceanVessel1" name="work.oceanVessel1" value="<s:property value="work.oceanVessel1" />" style="width:150px">
						<input type="hidden" id="oceanVessel1Hide" value="<s:property value="work.oceanVessel1" />" />
						<div style="line-height: 44px; float: left;">&nbsp;/&nbsp;</div>
						<input type="text" id="voyNo1" name="work.voyNo1" value="<s:property value="work.voyNo1" />" style="width:150px">
						<input type="hidden" id="voyNo1Hide" value="<s:property value="work.voyNo1" />" />
					</td>
				</tr>
			</s:if>
			<s:elseif test="work.item.type != 1">
				<tr>
					<td align="right"><s:if test="work.item.type == 2">CFS：</s:if><s:elseif test="work.item.type == 3">货站：</s:elseif></td>
					<td>
						<input type="text" id="oceanVessel1" name="work.oceanVessel1" value="<s:property value="work.oceanVessel1" />">
						<input type="hidden" id="oceanVessel1Hide" value="<s:property value="work.oceanVessel1" />" />
					</td>
				</tr>
			</s:elseif>
			<tr>
				<td align="right">
					<s:if test="work.item.type == 1">CY截关时间：</s:if>
					<s:elseif test="work.item.type == 2">CFS截关时间：</s:elseif>
					<s:elseif test="work.item.type == 3">货站入仓时间：</s:elseif>
				</td>
				<td>
					<input type="text" id="cyClosing1" name="work.cyClosing1" class="calendar" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" value="<s:date name="work.cyClosing1" format="yyyy-MM-dd HH:mm" />" >
					<input type="hidden" id="cyClosing1Hide" value="<s:date name="work.cyClosing1" format="yyyy-MM-dd HH:mm" />" />
				</td>
			</tr>
			<tr>
				<td align="right"><span class="stress">*</span>ETD：</td>
				<td>
					<input type="text" id="etd1" name="work.etd1" class="calendar" onclick="WdatePicker()" value="<s:date name="work.etd1" format="yyyy-MM-dd" />" >
					<input type="hidden" id="etd1Hide" value="<s:date name="work.etd1" format="yyyy-MM-dd" />" />
				</td>
			</tr>
			<tr>
				<td align="right">出发时间：</td>
				<td>
					<input type="text" id="departureTime1" name="work.departureTime1" class="calendar" onclick="WdatePicker()" value="<s:date name="work.departureTime1" format="yyyy-MM-dd" />" >
					<input type="hidden" id="departureTime1Hide" value="<s:date name="work.departureTime1" format="yyyy-MM-dd" />" />
				</td>
			</tr>
		</table>
		<div style="text-align: right; padding-top: 5px;">
			<input type="button" value="确认" onclick="savePointInfo('orgInfo');isInfo('etd1');" style="width: auto;" />&nbsp;
			<input type="button" value="取消" onclick="hidePopDiv('orgInfo')" style="width: auto;" />
		</div>
	</div>
</div>

<!-- 装货港信息 -->
<div id="polInfo" class="popdiv_inner">
	<div class="popdiv_inner_outter"></div>
	<div class="popdiv_close" onclick="cancelPointInfo('polInfo')"></div>
	<div class="popdiv_handle" style="font-size: 12px;" title="鼠标左键按住可拖动"><s:property value="#polTxt"/>信息</div>
	<div class="popdiv_content" style="500px">
		<table style="width: 100%; font-size: 14px; border-bottom: 1px solid #d0d0d0;">
			<s:if test="work.item.type != 3">
				<tr>
					<td align="right">船名/航次：</td>
					<td>
						<input type="text" id="oceanVessel2" name="work.oceanVessel2" value="<s:property value="work.oceanVessel2" />" style="width:150px">
						<input type="hidden" id="oceanVessel2Hide" value="<s:property value="work.oceanVessel2" />" />
						<div style="line-height: 44px; float: left;">&nbsp;/&nbsp;</div>
						<input type="text" id="voyNo2" name="work.voyNo2" value="<s:property value="work.voyNo2" />" style="width:150px">
						<input type="hidden" id="voyNo2Hide" value="<s:property value="work.voyNo2" />" />
					</td>
				</tr>
			</s:if>
			<s:elseif test="work.item.type == 3">
				<tr>
					<td align="right">航班：</td>
					<td>
						<input type="text" id="voyNo2" name="work.voyNo2" value="<s:property value="work.voyNo2" />">
						<input type="hidden" id="voyNo2Hide" value="<s:property value="work.voyNo2" />" />
					</td>
				</tr>
			</s:elseif>
			<s:if test="work.item.type != 1">
				<tr class="cyClosing2Td" style="display: none">
					<td align="right">
						<s:if test="work.item.type == 2">CFS：</s:if>
						<s:elseif test="work.item.type == 3">货站：</s:elseif>
					</td>
					<td>
						<input type="text" id="oceanVessel5" name="work.oceanVessel5" value="<s:property value="work.oceanVessel5" />" >
						<input type="hidden" id="oceanVessel5Hide" value="<s:property value="work.oceanVessel5" />" />
					</td>
				</tr>
			</s:if>
			<tr class="cyClosing2Td" style="display: none">
				<td align="right">
					<s:if test="work.item.type == 1">CY截关时间：</s:if>
					<s:elseif test="work.item.type == 2">CFS截关时间：</s:elseif>
					<s:elseif test="work.item.type == 3">货站入仓时间：</s:elseif>
				</td>
				<td>
					<input type="text" id="cyClosing2" name="work.cyClosing2" class="calendar" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" value="<s:date name="work.cyClosing2" format="yyyy-MM-dd HH:mm" />" >
					<input type="hidden" id="cyClosing2Hide" value="<s:date name="work.cyClosing2" format="yyyy-MM-dd HH:mm" />" />
				</td>
			</tr>
			<tr>
				<td align="right"><span class="stress">*</span>ETD：</td>
				<td>
					<input type="text" id="etd2" name="work.etd2" class="calendar" onclick="WdatePicker()" value="<s:date name="work.etd2" format="yyyy-MM-dd" />" >
					<input type="hidden" id="etd2Hide" value="<s:date name="work.etd2" format="yyyy-MM-dd" />" />
				</td>
			</tr>
			<tr>
				<td align="right">离港时间：</td>
				<td>
					<input type="text" id="departureTime2" name="work.departureTime2" class="calendar" onclick="WdatePicker()" value="<s:date name="work.departureTime2" format="yyyy-MM-dd" />" >
					<input type="hidden" id="departureTime2Hide" value="<s:date name="work.departureTime2" format="yyyy-MM-dd" />" />
				</td>
			</tr>
		</table>
		<div style="text-align: right; padding-top: 5px;">
			<input type="button" value="确认" onclick="savePointInfo('polInfo');isInfo('etd2');" style="width: auto;" />&nbsp;
			<input type="button" value="取消" onclick="hidePopDiv('polInfo')" style="width: auto;" />
		</div>
	</div>
</div>

<!-- 卸货港信息 -->
<div id="podInfo" class="popdiv_inner">
	<div class="popdiv_inner_outter"></div>
	<div class="popdiv_close" onclick="cancelPointInfo('podInfo')"></div>
	<div class="popdiv_handle" style="font-size: 12px;" title="鼠标左键按住可拖动"><s:property value="#podTxt"/>信息</div>
	<div class="popdiv_content" style="500px">
		<table style="width: 100%; font-size: 14px; border-bottom: 1px solid #d0d0d0;">
			<s:if test="work.item.type != 1">
				<tr class="releaseCargoAgent1Id" style="display: none">
					<td align="right">
						<s:if test="work.item.type == 2">CFS：</s:if>
						<s:elseif test="work.item.type == 3">货站：</s:elseif>
					</td>
					<td>
						<input type="text" id="oceanVessel4" name="work.oceanVessel4" value="<s:property value="work.oceanVessel4" />" >
						<input type="hidden" id="oceanVessel4Hide" value="<s:property value="work.oceanVessel4" />" />
					</td>
				</tr>
			</s:if>
			<tr>
				<td align="right"><span class="stress">*</span>ETA：</td>
				<td>
					<input type="text" id="eta1" name="work.eta1" class="calendar" onclick="WdatePicker()" value="<s:date name="work.eta1" format="yyyy-MM-dd" />" >
					<input type="hidden" id="eta1Hide" value="<s:date name="work.eta1" format="yyyy-MM-dd" />" />
				</td>
			</tr>
			<tr>
				<td align="right">到港时间：</td>
				<td>
					<input type="text" id="arrivalTime1" name="work.arrivalTime1" class="calendar" onclick="WdatePicker()" value="<s:date name="work.arrivalTime1" format="yyyy-MM-dd" />" >
					<input type="hidden" id="arrivalTime1Hide" value="<s:date name="work.arrivalTime1" format="yyyy-MM-dd" />" />
				</td>
			</tr>
			<tr class="releaseCargoAgent1Id" style="display: none">
				<td align="right">放货代理：</td>
				<td>
					<input type="text" id="releaseCargoAgent1" name="releaseCargoAgent1" value="<s:property value="work.releaseCargoAgent1.nickname" />"
						onkeyup="seachDataByKeyword('searchEmployeeBykeyword.action?type=1',this.value,'releaseCargoAgent1','releaseCargoAgent1Id',0,150);" style="width:150px">
					<input type="hidden" id="releaseCargoAgent1Id" name="work.releaseCargoAgent1.id" value="<s:property value="work.releaseCargoAgent1.id" />">
					<input type="hidden" id="releaseCargoAgent1Hide" value="<s:property value="work.releaseCargoAgent1.nickname" />">
					<input type="hidden" id="releaseCargoAgent1IdHide" value="<s:property value="work.releaseCargoAgent1.id" />">
					<a href="javascript:addEmployee('releaseCargoAgent1')" class="add_btn">&nbsp;</a>
					<font style="line-height: 56px;">&nbsp;</font>
				</td>
			</tr>
		</table>
		<div style="text-align: right; padding-top: 5px;">
			<input type="button" value="确认" onclick="savePointInfo('podInfo');isInfo('eta1');" style="width: auto;" />&nbsp;
			<input type="button" value="取消" onclick="hidePopDiv('podInfo')" style="width: auto;" />
		</div>
	</div>
</div>

<!-- 目的地信息 -->
<div id="desInfo" class="popdiv_inner">
	<div class="popdiv_inner_outter"></div>
	<div class="popdiv_close" onclick="cancelPointInfo('desInfo')"></div>
	<div class="popdiv_handle" style="font-size: 12px;" title="鼠标左键按住可拖动"><s:property value="#desTxt"/>信息</div>
	<div class="popdiv_content" style="500px">
		<table style="width: 100%; font-size: 14px; border-bottom: 1px solid #d0d0d0;">
			<s:if test="work.item.type != 1">
				<tr>
					<td align="right">
						<s:if test="work.item.type == 2">CFS：</s:if>
						<s:elseif test="work.item.type == 3">货站：</s:elseif>
					</td>
					<td>
						<input type="text" id="oceanVessel3" name="work.oceanVessel3" value="<s:property value="work.oceanVessel3" />" >
						<input type="hidden" id="oceanVessel3Hide" value="<s:property value="work.oceanVessel3" />" />
					</td>
				</tr>
			</s:if>
			<tr>
				<td align="right"><span class="stress">*</span>ETA：</td>
				<td>
					<input type="text" id="eta2" name="work.eta2" class="calendar" onclick="WdatePicker()" value="<s:date name="work.eta2" format="yyyy-MM-dd" />" >
					<input type="hidden" id="eta2Hide" value="<s:date name="work.eta2" format="yyyy-MM-dd" />" />
				</td>
			</tr>
			<tr>
				<td align="right">到达时间：</td>
				<td>
					<input type="text" id="arrivalTime2" name="work.arrivalTime2" class="calendar" onclick="WdatePicker()" value="<s:date name="work.arrivalTime2" format="yyyy-MM-dd" />" >
					<input type="hidden" id="arrivalTime2Hide" value="<s:date name="work.arrivalTime2" format="yyyy-MM-dd" />" />
				</td>
			</tr>
			<tr>
				<td align="right">放货代理：</td>
				<td>
					<input type="text" id="releaseCargoAgent2" name="releaseCargoAgent2" value="<s:property value="work.releaseCargoAgent2.nickname" />"
						onkeyup="seachDataByKeyword('searchEmployeeBykeyword.action?type=1',this.value,'releaseCargoAgent2','releaseCargoAgent2Id',0,150);" style="width:150px">
					<input type="hidden" id="releaseCargoAgent2Id" name="work.releaseCargoAgent2.id" value="<s:property value="work.releaseCargoAgent2.id" />">
					<input type="hidden" id="releaseCargoAgent2Hide" value="<s:property value="work.releaseCargoAgent2.nickname" />">
					<input type="hidden" id="releaseCargoAgent2IdHide" value="<s:property value="work.releaseCargoAgent2.id" />">
					<a href="javascript:addEmployee('releaseCargoAgent2')" class="add_btn">&nbsp;</a>
					<font style="line-height: 56px;">&nbsp;</font>
				</td>
			</tr>
		</table>
		<div style="text-align: right; padding-top: 5px;">
			<input type="button" value="确认" onclick="savePointInfo('desInfo');isInfo('eta2');" style="width: auto;" />&nbsp;
			<input type="button" value="取消" onclick="hidePopDiv('desInfo')" style="width: auto;" />
		</div>
	</div>
</div>
<script>
var pointType = 1;
var type = $('#type').val();
if(type == 1 || type == 2){
	pointType = 0;
}else if(type == 3){
	pointType = 2;
}else{
	pointType = 3;
}
$(function(){
	inputPoint('ORG');
	inputPoint('DES');
	$('#oceanVessel1,#voyNo1,#oceanVessel2,#voyNo2,#oceanVessel3,#oceanVessel4').each(function(){$(this).pleaseInput()});
})

var preErrorId = [];
function validateForm(){
	var errorId = [];
	var errorMsg = '';
	var orgId = $('#pointORGId').val();
	var polId = $('#pointPOLId').val();
	var tpId = $('#pointTPId').val();
	var podId = $('#pointPODId').val();
	var desId = $('#pointDESId').val();
	if(orgId == ''){
		errorId[errorId.length] = 'pointORG';
		errorMsg += '<s:property value="#orgTxt" escape="false"/>不能为空\r\n';
	}
	if(polId == ''){
		errorId[errorId.length] = 'pointPOL';
		errorMsg += '<s:property value="#polTxt" escape="false"/>不能为空\r\n';
	}
	if(podId == ''){
		errorId[errorId.length] = 'pointPOD';
		errorMsg += '<s:property value="#podTxt" escape="false"/>不能为空\r\n';
	}
	if(desId == ''){
		errorId[errorId.length] = 'pointDES';
		errorMsg += '<s:property value="#desTxt" escape="false"/>不能为空\r\n';
	}
	if(orgId != '' && desId != '' && orgId == desId){  //出发地和目的地
		errorId[errorId.length] = 'pointORG';
		errorId[errorId.length] = 'pointDES';
		errorMsg += '<s:property value="#orgTxt" escape="false"/>和<s:property value="#desTxt" escape="false"/>不能相同\r\n';
	}
	if(orgId != '' && podId != '' && desId != podId && orgId == podId){ //出发地和卸货港
		errorId[errorId.length] = 'pointORG';
		errorId[errorId.length] = 'pointPOD';
		errorMsg += '<s:property value="#orgTxt" escape="false"/>和<s:property value="#podTxt" escape="false"/>不能相同\r\n';
	}
	if(polId != '' && orgId != '' && polId != orgId){
		if(polId != '' && desId != '' && polId == desId){  //装货港地和目的地
			errorId[errorId.length] = 'pointPOL';
			errorId[errorId.length] = 'pointDES';
			errorMsg += '<s:property value="#polTxt" escape="false"/>和<s:property value="#desTxt" escape="false"/>不能相同\r\n';
		}
		if(polId != '' && podId != '' && desId != podId && polId == podId){ //装货港和卸货港
			errorId[errorId.length] = 'pointPOL';
			errorId[errorId.length] = 'pointPOD';
			errorMsg += '<s:property value="#polTxt" escape="false"/>和<s:property value="#podTxt" escape="false"/>不能相同\r\n';
		}
		if($('#transhipType1').val() == 0){  //请选择出发地到装货港的接驳工具
			errorId[errorId.length] = 'transhipType1';
			errorMsg += '请选择<s:property value="#orgTxt" escape="false"/>到<s:property value="#polTxt" escape="false"/>的接驳工具\r\n';
		}
	}
	if(podId != '' && desId != '' && podId != desId){
		if($('#transhipType2').val() == 0){  //请选择卸货港到目的地的接驳工具
			errorId[errorId.length] = 'transhipType2';
			errorMsg += '请选择<s:property value="#podTxt" escape="false"/>到<s:property value="#desTxt" escape="false"/>的接驳工具\r\n';
		}
	}
	if(tpId != ''){
		if(orgId != '' && orgId == tpId){  //出发地和中转港
			errorId[errorId.length] = 'pointORG';
			errorId[errorId.length] = 'pointTP';
			errorMsg += '<s:property value="#orgTxt" escape="false"/>和<s:property value="#tpTxt" escape="false"/>不能相同\r\n';
		}
		if(polId != '' && orgId != '' && polId != orgId && polId == tpId){  //装货港和中转港
			errorId[errorId.length] = 'pointPOL';
			errorId[errorId.length] = 'pointTP';
			errorMsg += '<s:property value="#polTxt" escape="false"/>和<s:property value="#tpTxt" escape="false"/>不能相同\r\n';
		}
		if(desId != '' && desId == tpId){  //目的地和中转港
			errorId[errorId.length] = 'pointDES';
			errorId[errorId.length] = 'pointTP';
			errorMsg += '<s:property value="#desTxt" escape="false"/>和<s:property value="#tpTxt" escape="false"/>不能相同\r\n';
		}
		if(podId != '' && desId != '' && podId != desId && podId == tpId){  //卸货港和中转港
			errorId[errorId.length] = 'pointPOD';
			errorId[errorId.length] = 'pointTP';
			errorMsg += '<s:property value="#podTxt" escape="false"/>和<s:property value="#tpTxt" escape="false"/>不能相同\r\n';
		}
	}
	
	if($('#bookingAgentId').val() == ''){
		errorId[errorId.length] = 'bookingAgent';
		errorMsg += '订舱代理\r\n';
	}
	if($('#carrier').val() == 0){
		errorId[errorId.length] = 'carrier';
		errorMsg += '船东\r\n';
	}
	if($('#cy2cy2').val() == 0){
		errorId[errorId.length] = 'cy2cy2';
		errorMsg += '交接方式\r\n';
	}
	if($('#payment2').val() == 0){
		errorId[errorId.length] = 'payment2';
		errorMsg += '运费支付方式\r\n';
	}
	if($('#releaseCargoType2').val() == 0){
		errorId[errorId.length] = 'releaseCargoType2';
		errorMsg += '放货方式\r\n';
	}
	if(orgId != polId && isInfo('etd1')){ //出发地信息
		errorMsg += '<s:property value="#orgTxt" escape="false"/>信息\r\n';
	}
	if(isInfo('etd2')){ //装货港信息
		errorMsg += '<s:property value="#polTxt" escape="false"/>信息\r\n';
	}
	if(isInfo('eta1')){ //卸货港信息
		errorMsg += '<s:property value="#podTxt" escape="false"/>信息\r\n';
	}
	if(podId != desId && isInfo('eta2')){ //目的地信息
		errorMsg += '<s:property value="#desTxt" escape="false"/>信息\r\n';
	}
	if(typeof saveAllWorkItem == 'function'){
		errorMsg += saveAllWorkItem();
	}
	for(i=0; i<preErrorId.length; i++){
		normalCssJNice(preErrorId[i]);
	}
	if(errorMsg != ''){
		preErrorId = errorId;
		for(i=0; i< errorId.length; i++){
			errorCssJNice(errorId[i]);
		}
		alert(errorMsg);
		return;
	}
	
	if(orgId == polId){
		$('#orgId input:text, #orgId input:hidden').val('')
	}
	if(desId == podId){
		$('#desId input:text, #desId input:hidden').val('')
	}
	if(tpId == ''){
		$('#pointTPId').val(0);
	}
	if($('#releaseCargoAgent1Id').val() == ''){
		$('#releaseCargoAgent1Id').val(0);
	}
	if($('#releaseCargoAgent2Id').val() == ''){
		$('#releaseCargoAgent2Id').val(0);
	}
	$('#oceanVessel1,#voyNo1,#oceanVessel2,#voyNo2,#oceanVessel3,#oceanVessel4').each(function(){ this.isInput(true) });
	var params = $("#workForm").serialize();
	$('#oceanVessel1,#voyNo1,#oceanVessel2,#voyNo2,#oceanVessel3,#oceanVessel4').each(function(){ this.isInput(false) });
	$.post('cts/workStep3?save=true',params,function(result){
		if(result.trim() == 'null'){
			alert('订单不存在或已经被删除');
		}else if(result.trim() == 'status5'){
			alert('该订单已归档');
		}else if(result.trim() == 'ok'){
			nextStep();
		}else{
			alert('保存失败');
		}
	})
}
//是否正确输入地点信息
function isInfo(id){
	var infoBtn = {'etd1':'orgInfoBtn','etd2':'polInfoBtn','eta1':'podInfoBtn','eta2':'desInfoBtn'}
	var isInfo = false;
	if($('#'+id).val() == ''){
		errorCssJNice(id);
		$('#'+infoBtn[id])[0].className = 'btn_info_red';
		isInfo = true;
	}else{
		normalCssJNice(id);
		$('#'+infoBtn[id])[0].className = 'btn_info';
		isInfo = false;
	}
	return isInfo;
}

function inputPoint(flag){
	var point1, point2, point1Id ,point2ID ,transhipTypeTd, transhipTypeTitle, infoBtn, infoTd;
	if(flag == 'ORG'){
		point1 = $('#pointORG');
		point1Id = $('#pointORGId');
		point2 = $('#pointPOL');
		point2Id = $('#pointPOLId');
		transhipTypeTd = $('#transhipType1Td');
		transhipTypeTitle = $('#transhipType1Title');
		infoBtn = $('#orgInfoBtn');
		infoTd = $('.cyClosing2Td');
	}else{
		point1 = $('#pointPOD');
		point1Id = $('#pointPODId');
		point2 = $('#pointDES');
		point2Id = $('#pointDESId');
		transhipTypeTd = $('#transhipType2Td');
		transhipTypeTitle = $('#transhipType2Title');
		infoBtn = $('#desInfoBtn');
		infoTd = $('.releaseCargoAgent1Id');
	}
	if(point2Id.val().trim().length == 0 && point1.val() == point1.val().toUpperCase()){
		point2.val(point1.val());
		point2Id.val(point1Id.val());
	}
	if(point1Id.val() != point2Id.val()){
		transhipTypeTitle.show();
		transhipTypeTd.find('img:first').hide();
		transhipTypeTd.find('div:first').show();
		transhipTypeTd.find('div:first').find('select').hide();
		infoBtn.css('visibility','visible');
		infoTd.hide();
	}else{
		transhipTypeTitle.hide();
		transhipTypeTd.find('img:first').show();
		transhipTypeTd.find('div:first').hide();
		infoBtn.css('visibility','hidden');
		transhipTypeTd.find('.jNiceSelectWrapper').find('a[index=0]')[0].click(); 
		infoTd.show();
	}
	if(typeof changeTypeDetail == 'function') changeTypeDetail();
}
//保存地点信息
function savePointInfo(div){
	$('#'+div).find('input:text,input:hidden').each(function(){
		if($('#'+this.id+'Hide').length > 0)
			$('#'+this.id+'Hide').val(this.value);
	})
	hidePopDiv(div);
	$('#oceanVessel1,#voyNo1,#oceanVessel2,#voyNo2').each(function(){$(this).pleaseInput()});
}
//取消还原地点信息
function cancelPointInfo(div){
	$('#'+div).find('input:text,input:hidden').each(function(){
		if($('#'+this.id+'Hide').length > 0)
			this.value = $('#'+this.id+'Hide').val();
	})
	$('#oceanVessel1,#voyNo1,#oceanVessel2,#voyNo2').each(function(){$(this).pleaseInput()});
}
</script>
</s:else>